#! /usr/bin/php
<?php
/**
 * Copyright (c) 2006-2008, Julien PORTALIER
 * http://featherphp.googlecode.com/
 * 
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 */

define('LF', "\n");
define('DS', DIRECTORY_SEPARATOR);

error_reporting(E_ALL);

require_once dirname(__FILE__).'/feather3/libs/files.php';
require_once dirname(__FILE__).'/vendors/gettext.php';


# finds PHP files
$files = array();
files::find($_SERVER['argv'][1], 'php|tpl', &$files);

# extracts translation strings from PHP code
$translations = Gettext::extract($files);

# saves translation strings in POT files (one per context)
foreach($translations as $ctx => $messages)
{
	$pot_content = Gettext::to_pot($messages, $ctx);
	file_put_contents($_SERVER['argv'][2]."/$ctx.pot", $pot_content);
}

